package com.lxf.clouduser.controller;

import com.alibaba.fastjson.JSONObject;
import com.lxf.clouduser.service.UserServeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author 罗兴发
 * @data 2025/6/25 9:20
 * @description：客服服务-控制层
 */
@RestController
@CrossOrigin  //跨域
@RequestMapping("/v1")
@Slf4j
public class UserServeController {
    @Resource
    UserServeService userServeService;

    /**
     * 发起在线非人工服务请求（用户使用）
     * @return
     */
    @PostMapping("/startNotArtificialServe")
    public String startNotArtificialServe(@RequestBody JSONObject json, HttpServletRequest request){
        return userServeService.startNotArtificialServe(json,request);
    }

    /**
     * 发起人工服务请求（用户使用）
     * @return
     */
    @PostMapping("/startArtificialServe")
    public String startArtificialServe(@RequestBody JSONObject json, HttpServletRequest request){
        return userServeService.startArtificialServe(json,request);
    }

    /**
     * 获取尚未被服务的人工客服请求（客服使用）
     * @return
     */
    @PostMapping("/getIsNotServe")
    public String getIsNotServe(@RequestBody JSONObject json, HttpServletRequest request){
        return userServeService.getIsNotServe(json,request);
    }

    /**
     * 获取尚未被服务的人工客服请求（客服使用）
     * @return
     */
    @PostMapping("/getServeByContent")
    public String getServeByContent(@RequestBody JSONObject json, HttpServletRequest request){
        return userServeService.getServeByContent(json,request);
    }

    /**
     * 应答用户发起的请求（客服使用）
     * @return
     */
    @PostMapping("/respUserServe")
    public String respUserServe(@RequestBody JSONObject json,HttpServletRequest request){
        return userServeService.respUserServe(json,request);
    }

    /**
     * 用户主动取消"人工客服"服务（用户使用）
     * @return
     */
    @PostMapping("/setUserServe")
    public String setUserServe(@RequestBody JSONObject json,HttpServletRequest request){
        return userServeService.setUserServe(json,request);
    }
}
